//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - SaaS Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================


//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - S+S Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================

using Microsoft.Practices.SmartClient.DisconnectedAgent;
using System;
using LitwareHR.Recruiting.Contract;
using Shp.Runtime.Contract;
using Microsoft.Practices.CompositeUI;
namespace LitwareHR.PublicApp.WinUX.DSA.Secure.ProcessService
{
    // Generated code for the web service.
    // Use this proxy to make requests to the service when working in an application that is occasionally connected
    
    
    public partial class Agent
    {
        IRequestQueue requestQueue;

        public Agent(IRequestQueue requestQueue)
        {
            this.requestQueue = requestQueue;
        }

        #region OpenRecruitingProcess

        /// <summary>
        /// Enqueues a request to the <c>OpenRecruitingProcess</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid OpenRecruitingProcess(Position position)
        {
            return OpenRecruitingProcess(position, GetOpenRecruitingProcessDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>OpenRecruitingProcess</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid OpenRecruitingProcess(Position position, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnOpenRecruitingProcessReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnOpenRecruitingProcessException");

            return EnqueueRequest("OpenRecruitingProcess", behavior, position);
        }

        public static OfflineBehavior GetOpenRecruitingProcessDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnOpenRecruitingProcessReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnOpenRecruitingProcessException");

            return behavior;
        }

        #endregion OpenRecruitingProcess

        #region GetRecruitingWorkflowListByApplicant

        /// <summary>
        /// Enqueues a request to the <c>GetRecruitingWorkflowListByApplicant</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid GetRecruitingWorkflowListByApplicant(Boolean isOpen)
        {
            return GetRecruitingWorkflowListByApplicant(isOpen, GetGetRecruitingWorkflowListByApplicantDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>GetRecruitingWorkflowListByApplicant</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid GetRecruitingWorkflowListByApplicant(Boolean isOpen, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListByApplicantReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListByApplicantException");

            return EnqueueRequest("GetRecruitingWorkflowListByApplicant", behavior, isOpen);
        }

        public static OfflineBehavior GetGetRecruitingWorkflowListByApplicantDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListByApplicantReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListByApplicantException");

            return behavior;
        }

        #endregion GetRecruitingWorkflowListByApplicant

        #region GetRecruitingWorkflowList

        /// <summary>
        /// Enqueues a request to the <c>GetRecruitingWorkflowList</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid GetRecruitingWorkflowList(Boolean isOpen)
        {
            return GetRecruitingWorkflowList(isOpen, GetGetRecruitingWorkflowListDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>GetRecruitingWorkflowList</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid GetRecruitingWorkflowList(Boolean isOpen, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListException");

            return EnqueueRequest("GetRecruitingWorkflowList", behavior, isOpen);
        }

        public static OfflineBehavior GetGetRecruitingWorkflowListDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnGetRecruitingWorkflowListException");

            return behavior;
        }

        #endregion GetRecruitingWorkflowList

        #region SubmitResume

        /// <summary>
        /// Enqueues a request to the <c>SubmitResume</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitResume(Resume resume)
        {
            return SubmitResume(resume, GetSubmitResumeDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>SubmitResume</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitResume(Resume resume, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitResumeReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitResumeException");

            return EnqueueRequest("SubmitResume", behavior, resume);
        }

        public static OfflineBehavior GetSubmitResumeDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitResumeReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitResumeException");

            return behavior;
        }

        #endregion SubmitResume

        #region SubmitInterview

        /// <summary>
        /// Enqueues a request to the <c>SubmitInterview</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitInterview(Interview interview)
        {
            return SubmitInterview(interview, GetSubmitInterviewDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>SubmitInterview</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitInterview(Interview interview, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitInterviewReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitInterviewException");

            return EnqueueRequest("SubmitInterview", behavior, interview);
        }

        public static OfflineBehavior GetSubmitInterviewDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitInterviewReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitInterviewException");

            return behavior;
        }

        #endregion SubmitInterview

        #region SubmitNegotiation

        /// <summary>
        /// Enqueues a request to the <c>SubmitNegotiation</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitNegotiation(Negotiation negotiation)
        {
            return SubmitNegotiation(negotiation, GetSubmitNegotiationDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>SubmitNegotiation</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitNegotiation(Negotiation negotiation, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitNegotiationReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitNegotiationException");

            return EnqueueRequest("SubmitNegotiation", behavior, negotiation);
        }

        public static OfflineBehavior GetSubmitNegotiationDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitNegotiationReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitNegotiationException");

            return behavior;
        }

        #endregion SubmitNegotiation

        #region SubmitAcceptance

        /// <summary>
        /// Enqueues a request to the <c>SubmitAcceptance</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitAcceptance(Acceptance acceptance)
        {
            return SubmitAcceptance(acceptance, GetSubmitAcceptanceDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>SubmitAcceptance</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitAcceptance(Acceptance acceptance, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitAcceptanceReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitAcceptanceException");

            return EnqueueRequest("SubmitAcceptance", behavior, acceptance);
        }

        public static OfflineBehavior GetSubmitAcceptanceDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitAcceptanceReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitAcceptanceException");

            return behavior;
        }

        #endregion SubmitAcceptance

        #region SubmitRejection

        /// <summary>
        /// Enqueues a request to the <c>SubmitRejection</c> web service method through the agent.
        /// </summary>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitRejection(Rejection rejection)
        {
            return SubmitRejection(rejection, GetSubmitRejectionDefaultBehavior());
        }

        /// <summary>
        /// Enqueues a request to the <c>SubmitRejection</c> web service method through the agent.
        /// </summary>
        /// <param name="behavior">The behavior associated with the offline request being enqueued.</param>
        /// <returns>The unique identifier associated with the request that was enqueued.</returns>
        public Guid SubmitRejection(Rejection rejection, OfflineBehavior behavior)
        {
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitRejectionReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitRejectionException");

            return EnqueueRequest("SubmitRejection", behavior, rejection);
        }

        public static OfflineBehavior GetSubmitRejectionDefaultBehavior()
        {
            OfflineBehavior behavior = GetAgentDefaultBehavior();
            behavior.ReturnCallback = new CommandCallback(typeof(Callback), "OnSubmitRejectionReturn");
            behavior.ExceptionCallback = new CommandCallback(typeof(Callback), "OnSubmitRejectionException");

            return behavior;
        }

        #endregion SubmitRejection

        #region Common

        public static OfflineBehavior GetAgentDefaultBehavior()
        {
            OfflineBehavior behavior = new OfflineBehavior();
            behavior.MaxRetries = 3;
            behavior.Stamps = 1;
            behavior.Expiration = DateTime.Now + new TimeSpan(1, 0, 0, 0);
            behavior.ProxyFactoryType = typeof(Microsoft.Practices.SmartClient.DisconnectedAgent.WCFProxyFactory<LitwareHR.Recruiting.Contract.IProcessSC>);

            return behavior;
        }

        private Guid EnqueueRequest(string methodName, OfflineBehavior behavior, params object[] arguments)
        {
            Request request = CreateRequest(methodName, behavior, arguments);

            requestQueue.Enqueue(request);

            return request.RequestId;
        }

        private static Request CreateRequest(string methodName, OfflineBehavior behavior, params object[] arguments)
        {
            Request request = new Request();
            request.MethodName = methodName;
            request.Behavior = behavior;
            request.CallParameters = arguments;

            request.OnlineProxyType = OnlineProxyType;
            request.Endpoint = Endpoint;

            return request;
        }

        public static Type OnlineProxyType
        {
            get
            {
                return typeof(LitwareHR.PublicApp.WinUX.ServiceProxy.Secure.ProcessService);
            }
        }

        public static string Endpoint
        {
            get
            {
                return String.Empty;
            }
        }
        #endregion
    }
}
